<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once(BASEPATH . '/application/helpers/tourtypes_helper.php');

if ( ! function_exists('booking_widget'))
{
	function booking_widget($tourtypes, $admin = false, $url)
	{
		?><!-- Bookings widget -->
<script language="javascript">
<!--
	function sendData()
	{

		$('availabilityResults').show();
		
		new Ajax.Updater('availabilityResults', '<?php echo $url ?>', { method: 'post', parameters: $('bookingForm').serialize()});
	}
-->
</script>

<form method="post" id="bookingForm" onSubmit="sendData(); return false;">
	<ul class="formContainer">
    	<li class="floatFix">
	        <label>Tour </label>
            <?php echo tourtypes_dropdown($tourtypes, null, true, false); ?>
        </li>
        
        <li class="floatFix">
            <label>Number of passengers</label>
            <input type="text" name="booking_passengers" id="booking_passengers" maxlength="2" value="1" />
        </li>  
                    
    	<li class="floatFix">
            <input type="hidden" name="admin" value="<?php echo $admin; ?>" />
            <input type="submit" class="submitButton" value="Check availability" name="availability" id="availability" />
        </li>                    
	</ul>
    <?php

		
		?>
</form>

<div id="availabilityResults" class="bookingAvailability" style="display:none;">
    <p id="searchingMarker">Searching...</p>
</div>  
        <?php
	}
}

?>